home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-21 | 542 b | 26 lines | [TEXT/R*ch] |
- --<<<
- -- Kaleida Labs, Inc.
- -- Field Guide to the ScriptX Language
- -- chapter 8, example 3
-
- -- creating a new class of exceptions
- global tooOld, abuela
-
- class PeopleException (Exception) end
- tooOld := new PeopleException name: "tooOld" \
- format: "No one lives to be %* years old."
-
- class People ()
- instance variables _age
- instance methods
- method ageGetter self ->
- return self._age
- method ageSetter self val -> (
- if val > 115 then report tooOld val
- else self._age := val
- )
- end
-
- abuela := new People
- abuela.age := 122
- -->>>